package com.example.admin.yuejian21.Adapter;

import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.admin.yuejian21.Bean.Club;
import com.example.admin.yuejian21.Bean.Concern;
import com.example.admin.yuejian21.R;
import com.example.admin.yuejian21.ViewHolder.ConcernViewHolder;
import com.example.admin.yuejian21.ViewHolder.renqiViewHolder;
import com.example.admin.yuejian21.activity.ClubDetailActivity;

import java.util.ArrayList;
import java.util.List;

import it.sephiroth.android.library.picasso.Picasso;

/**
 * Created by Admin on 2017/10/30.
 */

public class ConcernAdapter extends RecyclerView.Adapter {
    private List<Concern> ConcernList =new ArrayList<>();

    private Context context;
    private LayoutInflater layoutInflater;
    public ConcernAdapter(Context context, List<Concern> Concernlist ) {
        this.context = context;
        layoutInflater = LayoutInflater.from(context);
        this.ConcernList.addAll(Concernlist);
    }
    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View itemView =
                layoutInflater.inflate(R.layout.item_concern,parent,false);

        ConcernViewHolder holder =
                new ConcernViewHolder(itemView);

        return holder;

    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
        ConcernViewHolder ConcernViewHolder =
                (ConcernViewHolder) holder;
         Concern concern = ConcernList.get(position);

        String name =concern.getName();





        ConcernViewHolder.nameView.setText(name);





        Picasso
                .with(context)
                .load("http://172.24.10.175/workout/Uploads/"+ConcernList.get(position).getThumb())


                .into(
                        ConcernViewHolder .imageView);



    }

    @Override
    public int getItemCount() {
        return ConcernList.size();
    }
}
